home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / envprt / hpenv.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  16.3 KB  |  596 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Envelope Printer"
  5.    ClientHeight    =   4500
  6.    ClientLeft      =   915
  7.    ClientTop       =   2040
  8.    ClientWidth     =   7830
  9.    Height          =   5190
  10.    Icon            =   HPENV.FRX:0000
  11.    Left            =   855
  12.    LinkMode        =   1  'Source
  13.    LinkTopic       =   "Form1"
  14.    ScaleHeight     =   4500
  15.    ScaleWidth      =   7830
  16.    Top             =   1410
  17.    Width           =   7950
  18.    Begin TextBox Addresse6 
  19.       BorderStyle     =   0  'None
  20.       Height          =   380
  21.       Left            =   120
  22.       TabIndex        =   8
  23.       Top             =   3720
  24.       Width           =   4695
  25.    End
  26.    Begin TextBox Addresse5 
  27.       BorderStyle     =   0  'None
  28.       Height          =   380
  29.       Left            =   1080
  30.       TabIndex        =   7
  31.       Top             =   3000
  32.       Width           =   4695
  33.    End
  34.    Begin CommandButton Command2 
  35.       Caption         =   "&Clear"
  36.       Height          =   380
  37.       Left            =   6360
  38.       TabIndex        =   10
  39.       Top             =   2760
  40.       Width           =   975
  41.    End
  42.    Begin TextBox Addresse4 
  43.       BorderStyle     =   0  'None
  44.       Height          =   380
  45.       Left            =   1080
  46.       TabIndex        =   6
  47.       Top             =   2640
  48.       Width           =   4695
  49.    End
  50.    Begin CommandButton PrintButton 
  51.       Caption         =   "&Print"
  52.       Height          =   380
  53.       Left            =   6360
  54.       TabIndex        =   9
  55.       Top             =   2280
  56.       Width           =   975
  57.    End
  58.    Begin TextBox Addresse3 
  59.       BorderStyle     =   0  'None
  60.       Height          =   380
  61.       Left            =   1080
  62.       TabIndex        =   5
  63.       Top             =   2280
  64.       Width           =   4695
  65.    End
  66.    Begin TextBox Addresse2 
  67.       BorderStyle     =   0  'None
  68.       Height          =   380
  69.       Left            =   1080
  70.       TabIndex        =   4
  71.       Top             =   1920
  72.       Width           =   4695
  73.    End
  74.    Begin TextBox Addresse1 
  75.       BorderStyle     =   0  'None
  76.       Height          =   380
  77.       Left            =   1080
  78.       TabIndex        =   3
  79.       Top             =   1560
  80.       Width           =   4695
  81.    End
  82.    Begin PictureBox Picture1 
  83.       BackColor       =   &H0000FFFF&
  84.       Height          =   980
  85.       Left            =   6000
  86.       Picture         =   HPENV.FRX:0302
  87.       ScaleHeight     =   945
  88.       ScaleWidth      =   1065
  89.       TabIndex        =   0
  90.       TabStop         =   0   'False
  91.       Top             =   240
  92.       Width           =   1095
  93.       Begin Label Label1 
  94.          Alignment       =   1  'Right Justify
  95.          BackColor       =   &H0000FFFF&
  96.          Caption         =   "29
  97.          Height          =   260
  98.          Left            =   360
  99.          TabIndex        =   1
  100.          Top             =   600
  101.          Width           =   615
  102.       End
  103.       Begin Label Label2 
  104.          Alignment       =   1  'Right Justify
  105.          BackColor       =   &H0000FFFF&
  106.          Caption         =   "USA"
  107.          Height          =   260
  108.          Left            =   600
  109.          TabIndex        =   2
  110.          Top             =   360
  111.          Width           =   375
  112.       End
  113.    End
  114.    Begin Label PrinterLabel 
  115.       Alignment       =   2  'Center
  116.       BackColor       =   &H00FFFF00&
  117.       BorderStyle     =   1  'Fixed Single
  118.       ForeColor       =   &H00000000&
  119.       Height          =   380
  120.       Left            =   5160
  121.       TabIndex        =   15
  122.       Top             =   3720
  123.       Width           =   2295
  124.    End
  125.    Begin Label R4 
  126.       BackColor       =   &H00404040&
  127.       ForeColor       =   &H00FFFFFF&
  128.       Height          =   260
  129.       Left            =   240
  130.       TabIndex        =   14
  131.       Top             =   840
  132.       Width           =   3135
  133.    End
  134.    Begin Label R3 
  135.       BackColor       =   &H00404040&
  136.       ForeColor       =   &H00FFFFFF&
  137.       Height          =   260
  138.       Left            =   240
  139.       TabIndex        =   13
  140.       Top             =   600
  141.       Width           =   3135
  142.    End
  143.    Begin Label R2 
  144.       BackColor       =   &H00404040&
  145.       ForeColor       =   &H00FFFFFF&
  146.       Height          =   260
  147.       Left            =   240
  148.       TabIndex        =   12
  149.       Top             =   360
  150.       Width           =   3135
  151.    End
  152.    Begin Label R1 
  153.       BackColor       =   &H00404040&
  154.       Caption         =   "No Return Address"
  155.       ForeColor       =   &H00FFFFFF&
  156.       Height          =   260
  157.       Left            =   240
  158.       TabIndex        =   11
  159.       Top             =   120
  160.       Width           =   3135
  161.    End
  162.    Begin Menu ByeBye 
  163.       Caption         =   "&Quit"
  164.    End
  165.    Begin Menu RAMenu 
  166.       Caption         =   "&Return Address"
  167.    End
  168.    Begin Menu SelectPrinter 
  169.       Caption         =   "&Select Printer"
  170.       Begin Menu HPSelect 
  171.          Caption         =   "&HP Laserjet"
  172.       End
  173.       Begin Menu IBMSelect 
  174.          Caption         =   "&IBM ProPrinter"
  175.       End
  176.       Begin Menu PrintPrt 
  177.          Caption         =   "Printer Port"
  178.          Begin Menu Port1 
  179.             Caption         =   "LPT1"
  180.          End
  181.          Begin Menu Port2 
  182.             Caption         =   "LPT2"
  183.          End
  184.       End
  185.    End
  186.    Begin Menu AboutBox 
  187.       Caption         =   "&About"
  188.    End
  189. Dim address1 As String
  190. Dim address2 As String
  191. Dim address3 As String
  192. Dim address4 As String
  193. Dim address5 As String
  194. Dim address6 As String
  195. Dim Raddress1 As String
  196. Dim Raddress2 As String
  197. Dim Raddress3 As String
  198. Dim Raddress4 As String
  199. Sub AboutBox_Click ()
  200. cr$ = Chr$(13) + Chr$(10)
  201. TheMessage$ = "HP Envelope Printer" + cr$
  202. TheMessage$ = TheMessage$ + "
  203. 1991 Federal Hill Software" + cr$
  204. TheMessage$ = TheMessage$ + "" + cr$
  205. TheMessage$ = TheMessage$ + "This little utility prints a standard" + cr$
  206. TheMessage$ = TheMessage$ + "No. 10 envelope on an" + cr$
  207. TheMessage$ = TheMessage$ + "HP LaserJet II or IBM ProPrinter." + cr$ + "" + cr$
  208. TheMessage$ = TheMessage$ + "First, Select Your Printer." + cr$
  209. TheMessage$ = TheMessage$ + "Then fill in the address boxes and click Print." + cr$
  210. TheMessage$ = TheMessage$ + "No fuss, no muss, no sticky mess. Enjoy!" + cr$
  211. TheStyle = 48
  212. TheTitle$ = "HP Envelope Printer"
  213. MsgBox TheMessage$, TheStyle, TheTitle$
  214. End Sub
  215. Sub Addresse1_GotFocus ()
  216.     Addresse1.backcolor = QBColor(14)
  217. End Sub
  218. Sub Addresse1_KeyDown (KeyCode As Integer, Shift As Integer)
  219.     If KeyCode = KEY_DOWN Then
  220.         KeyCode = 0
  221.         SendKeys "{TAB}"
  222.         GoTo done
  223.         End If
  224.     If KeyCode = KEY_UP Then
  225.         KeyCode = 0
  226.         SendKeys "+({TAB})"
  227.         GoTo done
  228.         End If
  229.         
  230. done:
  231. End Sub
  232. Sub Addresse1_KeyPress (keyascii As Integer)
  233.     If keyascii = 13 Then
  234.     keyascii = 0
  235.     SendKeys "{TAB}"
  236.     End If
  237. End Sub
  238. Sub Addresse1_LostFocus ()
  239.     Addresse1.backcolor = QBColor(15)
  240. End Sub
  241. Sub Addresse2_GotFocus ()
  242.     Addresse2.backcolor = QBColor(14)
  243. End Sub
  244. Sub Addresse2_KeyDown (KeyCode As Integer, Shift As Integer)
  245.     If KeyCode = KEY_DOWN Then
  246.         KeyCode = 0
  247.         SendKeys "{TAB}"
  248.         GoTo done2
  249.         End If
  250.     If KeyCode = KEY_UP Then
  251.         KeyCode = 0
  252.         SendKeys "+({TAB})"
  253.         GoTo done2
  254.         End If
  255. done2:
  256. End Sub
  257. Sub Addresse2_KeyPress (keyascii As Integer)
  258.     If keyascii = 13 Then
  259.     keyascii = 0
  260.     SendKeys "{TAB}"
  261.     End If
  262. End Sub
  263. Sub Addresse2_LostFocus ()
  264.     Addresse2.backcolor = QBColor(15)
  265. End Sub
  266. Sub Addresse3_GotFocus ()
  267.     Addresse3.backcolor = QBColor(14)
  268. End Sub
  269. Sub Addresse3_KeyDown (KeyCode As Integer, Shift As Integer)
  270.     If KeyCode = KEY_DOWN Then
  271.         KeyCode = 0
  272.         SendKeys "{TAB}"
  273.         GoTo done3
  274.         End If
  275.     If KeyCode = KEY_UP Then
  276.         KeyCode = 0
  277.         SendKeys "+({TAB})"
  278.         GoTo done3
  279.         End If
  280. done3:
  281. End Sub
  282. Sub Addresse3_KeyPress (keyascii As Integer)
  283.     If keyascii = 13 Then
  284.     keyascii = 0
  285.     SendKeys "{TAB}"
  286.     End If
  287. End Sub
  288. Sub Addresse3_LostFocus ()
  289.     Addresse3.backcolor = QBColor(15)
  290. End Sub
  291. Sub Addresse4_GotFocus ()
  292.     Addresse4.backcolor = QBColor(14)
  293. End Sub
  294. Sub Addresse4_KeyDown (KeyCode As Integer, Shift As Integer)
  295.     If KeyCode = KEY_DOWN Then
  296.         KeyCode = 0
  297.         SendKeys "{TAB}"
  298.         GoTo done4
  299.         End If
  300.     If KeyCode = KEY_UP Then
  301.         KeyCode = 0
  302.         SendKeys "+({TAB})"
  303.         GoTo done4
  304.         End If
  305. done4:
  306. End Sub
  307. Sub Addresse4_KeyPress (keyascii As Integer)
  308.     If keyascii = 13 Then
  309.     keyascii = 0
  310.     SendKeys "{TAB}"
  311.     End If
  312. End Sub
  313. Sub Addresse4_LostFocus ()
  314.     Addresse4.backcolor = QBColor(15)
  315. End Sub
  316. Sub Addresse5_GotFocus ()
  317.     Addresse5.backcolor = QBColor(14)
  318. End Sub
  319. Sub Addresse5_KeyDown (KeyCode As Integer, Shift As Integer)
  320.     If KeyCode = KEY_DOWN Then
  321.         KeyCode = 0
  322.         SendKeys "{TAB}"
  323.         GoTo done5
  324.         End If
  325.     If KeyCode = KEY_UP Then
  326.         KeyCode = 0
  327.         SendKeys "+({TAB})"
  328.         GoTo done5
  329.         End If
  330. done5:
  331. End Sub
  332. Sub Addresse5_KeyPress (keyascii As Integer)
  333.     If keyascii = 13 Then
  334.     keyascii = 0
  335.     SendKeys "{TAB}"
  336.     End If
  337. End Sub
  338. Sub Addresse5_LostFocus ()
  339.     Addresse5.backcolor = QBColor(15)
  340. End Sub
  341. Sub Addresse6_GotFocus ()
  342.     Addresse6.backcolor = QBColor(14)
  343. End Sub
  344. Sub Addresse6_KeyDown (KeyCode As Integer, Shift As Integer)
  345.     If KeyCode = KEY_DOWN Then
  346.         KeyCode = 0
  347.         SendKeys "{TAB}"
  348.         'SendKeys "({TAB})"
  349.         GoTo done6
  350.         End If
  351.     If KeyCode = KEY_UP Then
  352.         KeyCode = 0
  353.         SendKeys "+({TAB})"
  354.         GoTo done6
  355.         End If
  356. done6:
  357. End Sub
  358. Sub Addresse6_KeyPress (keyascii As Integer)
  359.     If keyascii = 13 Then
  360.     keyascii = 0
  361.     Addresse1.SetFocus
  362.     End If
  363. End Sub
  364. Sub Addresse6_LostFocus ()
  365.     Addresse6.backcolor = QBColor(15)
  366. End Sub
  367. Sub ByeBye_Click ()
  368. cr$ = Chr$(13) + Chr$(10)
  369. TheMessage$ = "Click OK to Exit."
  370. TheStyle = 33
  371. TheTitle$ = "HP Envelope Printer"
  372. TheAnswer = MsgBox(TheMessage$, TheStyle, TheTitle$)
  373. If TheAnswer = 1 Then End 'Answered OK
  374. End Sub
  375. Sub clearem ()
  376. Addresse2.backcolor = QBColor(15)
  377. Addresse3.backcolor = QBColor(15)
  378. Addresse4.backcolor = QBColor(15)
  379. Addresse5.backcolor = QBColor(15)
  380. Addresse6.backcolor = QBColor(15)
  381. End Sub
  382. Sub Command1_Click ()
  383. cr$ = Chr$(13) + Chr$(10)
  384. TheMessage$ = "Click OK to Exit."
  385. TheStyle = 33
  386. TheTitle$ = "HP Envelope Printer"
  387. TheAnswer = MsgBox(TheMessage$, TheStyle, TheTitle$)
  388. If TheAnswer = 1 Then  'Answered OK
  389. Else     'Answered Cancel
  390. Addresse1.SetFocus
  391. End If
  392. End Sub
  393. Sub Command1_KeyDown (KeyCode As Integer, Shift As Integer)
  394.     If KeyCode = KEY_DOWN Then
  395.         KeyCode = 0
  396.         SendKeys "{TAB}"
  397.         'SendKeys "({TAB})"
  398.         GoTo done8
  399.         End If
  400.     If KeyCode = KEY_UP Then
  401.         KeyCode = 0
  402.         SendKeys "+({TAB})"
  403.         GoTo done8
  404.         End If
  405. done8:
  406. End Sub
  407. Sub Command2_Click ()
  408. clearem
  409. cr$ = Chr$(13) + Chr$(10)
  410. TheMessage$ = "Erase Address Information?"
  411. TheStyle = 36
  412. TheTitle$ = "MsgBox Editor"
  413. TheAnswer = MsgBox(TheMessage$, TheStyle, TheTitle$)
  414. If TheAnswer = 6 Then  'Answered Yes
  415. Addresse1.text = ""
  416. Addresse2.text = ""
  417. Addresse3.text = ""
  418. Addresse4.text = ""
  419. Addresse5.text = ""
  420. Addresse6.text = ""
  421. Addresse2.backcolor = QBColor(15)
  422. Addresse3.backcolor = QBColor(15)
  423. Addresse4.backcolor = QBColor(15)
  424. Addresse5.backcolor = QBColor(15)
  425. Addresse6.backcolor = QBColor(15)
  426. Addresse1.SetFocus
  427. Else     'Answered No
  428.  Addresse1.SetFocus
  429. End If
  430. End Sub
  431. Sub Command2_KeyDown (KeyCode As Integer, Shift As Integer)
  432.     If KeyCode = KEY_DOWN Then
  433.         KeyCode = 0
  434.         SendKeys "{TAB}"
  435.         'Addresse1.SetFocus
  436.         'GoTo done9
  437.         End If
  438.     If KeyCode = KEY_UP Then
  439.         KeyCode = 0
  440.         SendKeys "(+{TAB})"
  441.         GoTo done9
  442.         End If
  443. done9:
  444. End Sub
  445. Sub Form_Load ()
  446.     IBM = 0
  447.     HP = 1
  448.     PrinterLabel.Caption = "HP LaserJet/LPT1"
  449.     PrinterPort = 1
  450.     IBMSelect.checked = 0
  451.     HpSelect.checked = -1
  452.     Port1.checked = -1
  453.     Port2.checked = 0
  454. End Sub
  455. Sub HPSelect_Click ()
  456.     HP = 1
  457.     IBM = 0
  458.     PrinterLabel.Caption = "HP LaserJet/LPT" + Format$(PrinterPort, "0")
  459.     HpSelect.checked = -1
  460.     IBMSelect.checked = 0
  461. End Sub
  462. Sub IBMSelect_Click ()
  463.     IBM = 1
  464.     HP = 0
  465.     IBMSelect.checked = -1
  466.     HpSelect.checked = 0
  467.     PrinterLabel.Caption = "IBM ProPrinter/LPT" + Format$(PrinterPort, "0")
  468. End Sub
  469. Sub Picture1_Click ()
  470.     nl$ = Chr$(13) + Chr$(10)
  471.     MsgBox "It's Your Flag." + nl$ + "Fly it Proudly!"
  472. End Sub
  473. Sub Port1_Click ()
  474.     PrinterPort = 1
  475.     Port1.checked = -1
  476.     Port2.checked = 0
  477.     WhichPrinter$ = PrinterLabel.Caption
  478.     L = Len(WhichPrinter$)
  479.     Mid$(WhichPrinter$, L, 1) = "1"
  480.     PrinterLabel.Caption = WhichPrinter$
  481. End Sub
  482. Sub Port2_Click ()
  483.     PrinterPort = 2
  484.     Port2.checked = -1
  485.     Port1.checked = 0
  486.     WhichPrinter$ = PrinterLabel.Caption
  487.     L = Len(WhichPrinter$)
  488.     Mid$(WhichPrinter$, L, 1) = "2"
  489.     PrinterLabel.Caption = WhichPrinter$
  490. End Sub
  491. Sub Printbutton_click ()
  492. clearem
  493. cr$ = Chr$(13) + Chr$(10)
  494. TheMessage$ = "Put Envelope in Slot. Click OK to Print."
  495. TheStyle = 49
  496. TheTitle$ = "MsgBox Editor"
  497. TheAnswer = MsgBox(TheMessage$, TheStyle, TheTitle$)
  498. If TheAnswer <> 1 Then GoTo nerf 'Answered OK
  499. address1 = Chr$(27) + "*p1800X" + Chr$(27) + "*p1150Y"
  500. address2 = Chr$(27) + "*p1800X" + Chr$(27) + "*p1200Y"
  501. address3 = Chr$(27) + "*p1800X" + Chr$(27) + "*p1250Y"
  502. address4 = Chr$(27) + "*p1800X" + Chr$(27) + "*p1300Y"
  503. address5 = Chr$(27) + "*p1800X" + Chr$(27) + "*p1350Y"
  504. address6 = Chr$(27) + "*p700X" + Chr$(27) + "*p1450Y"
  505. Raddress1 = Chr$(27) + "*p490X" + Chr$(27) + "*p625Y"
  506. Raddress2 = Chr$(27) + "*p490X" + Chr$(27) + "*p675Y"
  507. Raddress3 = Chr$(27) + "*p490X" + Chr$(27) + "*p725Y"
  508. Raddress4 = Chr$(27) + "*p490X" + Chr$(27) + "*p775Y"
  509.  If PrinterPort = 1 Then Open "\dev\lpt1" For Output As 1
  510.  If PrinterPort = 2 Then Open "\dev\lpt2" For Output As 1
  511.     If IBM = 0 Then GoTo dohp
  512.        Print #1, Chr$(27) + Chr$(71)
  513.        For r = 1 To 5: Print #1, " ": Next
  514.        If UseRa <> 0 Then
  515.        Print #1, Tab(2); Raddress.ra1.text
  516.        Print #1, Tab(2); Raddress.ra2.text
  517.        Print #1, Tab(2); Raddress.ra3.text
  518.        Print #1, Tab(2); Raddress.ra4.text
  519.        End If
  520.        If UseRa = 0 Then
  521.        For r = 1 To 4: Print #1, " ": Next
  522.        End If
  523.        For r = 1 To 5: Print #1, " ": Next
  524.     Print #1, Tab(40); Addresse1.text
  525.     Print #1, Tab(40); Addresse2.text
  526.     Print #1, Tab(40); Addresse3.text
  527.     Print #1, Tab(40); Addresse4.text
  528.     Print #1, Tab(40); Addresse5.text
  529.     Print #1, " "
  530.     Print #1, " "
  531.     Print #1, Tab(8); Addresse6.text
  532.     For ui = 1 To 8
  533.     Print #1, " "
  534.     Next
  535.     Close #1
  536.     GoTo nerf
  537. dohp:
  538.     Print #1, Chr$(27) + "&l1O";
  539.     If UseRa <> 0 Then
  540.        Print #1, Raddress1 + Raddress.ra1.text;
  541.        Print #1, Raddress2 + Raddress.ra2.text;
  542.        Print #1, Raddress3 + Raddress.ra3.text;
  543.        Print #1, Raddress4 + Raddress.ra4.text;
  544.        End If
  545.     Print #1, address1 + Addresse1.text;
  546.     Print #1, address2 + Addresse2.text;
  547.     Print #1, address3 + Addresse3.text;
  548.     Print #1, address4 + Addresse4.text;
  549.     Print #1, address5 + Addresse5.text;
  550.     Print #1, address6 + Addresse6.text;
  551.     Print #1, Chr$(12);
  552.     Print #1, Chr$(27) + "&l0O";
  553.     Close #1
  554.      'Answered Cancel
  555.     'End If
  556. nerf:
  557.     Addresse1.SetFocus
  558. End Sub
  559. Sub PrintButton_KeyDown (KeyCode As Integer, Shift As Integer)
  560.     If KeyCode = KEY_DOWN Then
  561.         KeyCode = 0
  562.         SendKeys "{TAB}"
  563.         GoTo done7
  564.         End If
  565.     If KeyCode = KEY_UP Then
  566.         KeyCode = 0
  567.         SendKeys "+({TAB})"
  568.         GoTo done7
  569.         End If
  570.         
  571. done7:
  572. End Sub
  573. Sub Printit_Click ()
  574. Printbutton_click
  575. End Sub
  576. Sub R1_Click ()
  577.     clearem
  578.     Raddress.Show
  579. End Sub
  580. Sub R2_Click ()
  581.     clearem
  582.     Raddress.Show
  583. End Sub
  584. Sub R3_Click ()
  585.     clearem
  586.     Raddress.Show
  587. End Sub
  588. Sub R4_Click ()
  589.     clearem
  590.     Raddress.Show
  591. End Sub
  592. Sub RAMenu_Click ()
  593.     clearem
  594.     Raddress.Show
  595. End Sub
  596.